home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Commodore Free 22
/
Commodore_Free_Issue_22_2008_Commodore_Computer_Club.d64
/
t.uiec 2
< prev
next >
Wrap
Text File
|
2023-02-26
|
12KB
|
408 lines
u
UIEC INFORMATION
CONTINUED FROM PART 1
- M-R, M-W, M-E Memory Reading returns
random data of the requested length.
Memory Writing knows about the address
used for changing the device address on
a 1541 and will change the address of
sd2iec to the requested value. It will
also check if the transmitted data
corresponds to any of the known
software fastloaders so the correct
emulation code can be used when M-E is called.
- E-R, E-W Both commands work like M-R
and M-W, but instead of reading/writing
RAM they allow access to a user-area of
the EEPROM. This area currently holds
512 bytes and any access beyond this
area will result in a 32 SYNTAX ERROR.
It is strongly recommended to work
on a protocol for sharing this area
between multiple applications that
want to store their configuration in
there, but that is beyond the scope
of this project.
As the contents of the EEPROM have
to be copied to RAM before they can
be sent to the computer, it is not
possible to read more data with a
single command than the error
message buffer (default size: 36
bytes) can hold. Similarly, writing is
restricted by the size of the command
buffer (at least 42 bytes for
compatibility, expected to be at least
100 bytes in release versions).
The user-area does not interfere with
the stored configuration (XW) in any
way.
Long File Names:
================
Long file names (i.e. names not within
the 8.3 limits) are supported on FAT,
but for compatibility reasons the 8.3
name is used if the long name exceeds
16 characters. If you use anything but
ASCII characters on the PC or their
PETSCII equivalents on the Commodore,
you may get strange characters on the
other system because the LFN use
unicode characters on disk, but sd2iec
parses only the low byte of each
character in the name.
Partition:
==========
sd2iec features a multi-partition
support similar to that of the CMD
drives. The partitions (which may be
on separate drives for some hardware
configurations) are accessed using the
drive number of the commands sent from
the computer and are numbered starting
with 1. Partition 0 is a special case:
Because most software doesn't support
drive numbers, or always sends drive
number 0, this partition points to the
currently selected partition. By
default, accesses to partition 0 will
access partition 1, this can be
changed by sending "CP<num>" over the
command channel with <num> being an
ASCII number from 1 to 255.
"C<Shift-P"
(0x42 0xd0) works the same, but
expects a binary partition number as
the third character of the command.
Software fastloaders:
=====================
Turbodisk
---------
Turbodisk is detected by the CRC of
its 493 byte long floppy code and
the M-E address 0x0303. The same
code seems to be used under various
names, among them "Turbodisk" (both 2.1
and 2.2) and "Fast-Load". Unfortunately
the timing requirements are extremely
tight and cannot be met with the
internal RC oscillator of the AVR
even if calibrated. You really need an
external 8MHz crystal or the data
read by the C64 will be gibberish.
It is not known if there is an NTSC-
compatible version of this fastloader.
Final Cartridge III
-------------------
Both the fast loader and the fast
saver of Final Cartridge III are
supported.
The fast loader seems to work
without a crystal, the fast saver was
not tested. It is not known if there is
an NTSC-compatible version using the
same drive code, but at least for
the fastloader the FC3 rom seems to
contain two different C64-side
implementations.
Action Replay 6
---------------
The AR6 reads a byte from the drive
rom to check which fastloader it
should use. sd2iec returns a value that
should force the cartridge to use
the standard kernal loader instead
of its (still unsupported) fastloader.
Dreamload
---------
Dreamload uses direct track/sector
access, so it is only supported on D41
or similar disk image formats. As
sd2iec has to wait for commands from
the C64 constantly the disk change
buttons may become unresponsive,
try multiple times if you need to.
Dreamload is a "captive" fastloader,
sd2iec stays in Dreamload mode until
it receives a "quit loader" command
from the C64. To force sd2iec to
resume normal operation, hold the disk
change button until the red LED
turns on (just like sleep mode).
Please note that Dreamload does not
work with more than one device on the
serial bus due to the way it uses
the ATN line.
JiffyDOS:
=========
The JiffyDOS protocol has very relaxed
timing constraints compared to
Turbodisk, but still not as relaxed as
the standard Commodore IEC protocol.
Jiffy seems to tolerate slightly
mis-tuned RC oscillators, but you
still shouldn't expect it to work
without oscillator calibration. If the
frequency error is too big you WILL
get wrong data which usually manifests
as a FILE NOT FOUND error, because the
name the drive received was already
garbled.
x00 files:
==========
P00/S00/U00/R00 files are
transparently supported, that means
they show up in the directory listing
with their internal file name; instead
of the FAT file name. Renaming them
only changes the internal name. The XE
command defines if x00 extensions are
used when writing files, by default
sd2iec uses them for SEQ/USR/REL files
but not for PRG. Parsing of x00 files
is always enabled even when writing
them is not.
x00 files are recognized by checking
both the extension of the file
(P/S/U/R with a two-digit suffix) and
the header signature.
Disk Images:
============
Disk images are recognized by their
file extension (.D64, .D41) and their
file size (must be one of 174848,
175531). If the image has an error
info block appended, it will be used
to simulate read errors. Writing to a
sector with an error will always work,
but it will not clear the indicated
error.
M2I files:
==========
M2I files are fully supported. sd2iec
supports SEQ and USR files in this
format in addition to PRG and DEL
which were already implemented in
MMC2IEC. For compatibility reasons the
file type is not checked when opening
files. Inside an M2I file the files
are always shown as 0 (DEL) or 1
blocks; because calling stat for every
file was slowing down the directory
listing too much. For compatibility
with existing M2I files the data files
do not use P00 headers even when the
file type is SEQ or USR.
Changing Disk Images
====================
Because some programs require more
than one disk side there is support
for changing the currently mounted
disk image with a button connected to
the disk change pin.
If your circuit doesn't have a disk
change pin/button you might be able to
add it yourself:
- For the original MMC2IEC and the NKC
MMC2IEC:
Connect a button from PA4 to ground.
PA4 is pin 36 on the DIL version
of the controller or pin 33 on the
surface-mount version.
- For Shadowolf's MMC2IEC 1.x PCBs:
Connect a button from PC4 to ground.
PC4 is pin 23 on the DIL version
of the controller or pin 23 on the
surface-mount version.
- Any other circuit without disk
change pin on a convenient connector
somewhere and no button dedicated to
that function: Please check
with the supplier of the board, and
read config.h in the sources
to find out how to connect it.
To use this functionality, create a
text file that lists the file names of
all disk images you want to swap
between, one per line. The file names
are parsed in the same way as the CD
command, so you can include a path to
the image if desired.
Examples:
=== example 1 ===
FOO.D64
BAR.D64
BAZ.D64
=== end of example 1 ===
=== example 2 ===
//NEATGAME/:DISK1A.D64
//NEATGAME/:DISK1B.D64
//NEATGAME/:DISK2A.D64
//NEATGAME/:DISK2B.D64
=== end of example 2 ===
The swap list is enabled by sending
"XS:filename" over the command channel
with filename being the name of the
image list you created, parsed in the
same way as any other file name.
After sending XS the first image in
the list is automatically mounted. To
switch to the next image in the list,
push the button. If the new image was
mounted successfully both LEDs will
blink twice. When you've reached the
last image in the list pushing the
button will mount the first image
again. All of this is completely
compatible with normal image
mounting/unmounting, so you can
unmount the disk image any time you
want, and resume the mount cycle later
by pushing the button.
Due to the way this feature is
implemented you are not limited to a
swap list containing just D64 images,
M2I and even FAT directories will work
too.FIXME: Does that still work?
If you press the button when no list
has been set before, or when the
previous list was cleared by sending
XS the software will look for a file
called AUTOSWAP.LST in the current
(FAT-) directory and use this as the
current swap list until you deactivate
it or manually change the directory
(otherwise an AUTOSWAP.LST in the new
directory would be ignored until you
send XS, killing the nice "it just
works" feeling).
FIXME: Integrate the following into
the preceding
The second disk change button is on
- PA5 for LarsP/NKC
- PC3 for Shadowolf's MMC2IEC 1.x
- PC2 for Shadowolf's sd2iec 1.x
("Reserve" on the header)
- PG4 for uIEC
Either of those buttons will trigger
the use of AUTOSWAP.LST. If a swap
list is already active, the first
button will switch to the next image
in the list, the second button will
switch to the previous image in the
list and pushing both buttons together
will switch to the first image in the
list.
The confirmation blink is red+green
followed by green for "next", by red
for "previous" and by red+green for
"first".
Sleep Mode:
===========
If you hold the disk change button
down for two seconds, sd2iec will
enter "sleep mode". In this mode it
doesn't listen to the bus at all until
you hold down the disk change button
for two seconds again which resumes
normal operation. Sleep mode allows
you to keep sd2iec connected to the
serial bus even when you load
something from a different drive that
uses a fast loader that doesn't work
with more than one device on the bus.
While sleep mode is active, the red
LED will be on and the green LED will
be off.
Other important notes:
======================
- File overwrite (@foo) is implemented
by deleting the file first.
- File sizes in the directory are in
blocks (of 254 bytes), but
the blocks free message actually
reports free clusters. It is
a compromise of compatibility,
accuracy and code size.
- If known, the low byte of the next
line link pointer of the directory
listing will be set to (file size
MOD 254)+2, so you can calculate the
true size of the file if required.
The 2 is added so it can never be
mistaken for an end marker (0) or
for the default value (1, used by at
least the 1541 and 1571 disk
drives).
- If your hardware supports more than
one SD card, changing either one
will reset the current partition to
1 and the current directory of
all partitions to the root drive.
Doing this just for the card that
was changed would cause lots of
problems if the number of partitions
on the previous and the newly
inserted cards are different.
Compilation notes:
==================
sd2iec is set up to be compiled in
multiple configurations, controlled by
configuration files. By default the
Makefile looks for a file named
'config', but you can override it by
providing the name on the make command
line with "make CONFIG=filename". If
you are using *BSD you may have to
edit the Makefile to use another awk
implementation instead of gawk -
unfortunately WinAVR compatibility
requires using gawk in there.
An example configuration file named
"config-example" is provided with the
source code, as well as abridged files
corresponding to the release binaries.
If you want to compile sd2iec for a
custom hardware you may have to edit
config.h too to change the port
definitions.
==========